﻿using SXFramWork.Core;
using SXFramWork.Model;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace SXFramWork.Repository.Repository
{
    public class SysMessageRepository: RepositoryAbstract<SysMessageEntity>, ISysMessageRepository
    {
        public SysMessageRepository(IDbContext dbContext):base(dbContext)
        {

        }

        public async Task<IList<SysMessageEntity>> Query(SysMessageQueryModel model)
        {
            var sql =@"select ( select stuff( (select '，'+truename from SysUser where CHARINDEX(','+ltrim(Id)+',',','+s.touserid+',') >0 
            FOR XML PATH('')),1,1,''))touserid,id,Content,type,CreateTime,CreatorName from SysMessage s";
            return await FromSql.GetPageListAsync(sql, model);
        }
    }
}
